package ua.kharkov.knure.pereverziev.diploma.db.entity;

import java.io.Serializable;

/**
 * Root of all entities which have identifier field.
 * 
 * @author A.Pereverziev
 * 
 */
public abstract class HasId implements Serializable, Comparable<HasId> {

	private static final long serialVersionUID = 8466257860808346236L;

	public abstract Long getId();

	public abstract void setId(Long id);

	@Override
	public int compareTo(HasId object) {
		int result = 0;
		if (getId() > object.getId())
			result = 1;
		else if (getId() < object.getId())
			result = -1;
		return result;
	}

}
